package com.design02_Structural.pattern11_composite.example02;

/**
 * @ClassName Client
 * @Description TODO
 * @Author zhangjunhao
 * @DATE 2023/9/6 0:25
 */
public class Client {

    public static void main(String[] args) {

        //根节点
        Directory rootDir = new Directory("root");
        //树枝节点
        Directory binDir = new Directory("bin");


        //向bin目录中添加叶子节点
        binDir.add(new File("vi",10000));
        binDir.add(new File("test",20000));
        Directory tmpDir = new Directory("tmp");

        Directory usrDir = new Directory("usr");
        Directory mysqlDir = new Directory("mysql");
        mysqlDir.add(new File("my.cnf",30));
        mysqlDir.add(new File("test.db",25000));
        usrDir.add(mysqlDir);


        rootDir.add(binDir);
        rootDir.add(tmpDir);
        rootDir.add(mysqlDir);
        rootDir.printList("");

        ///root(55030)
        /// bin(30000)
        /// bin/vi(10000)
        /// bin/test(20000)
        /// tmp(0)
        /// mysql(25030)
        /// mysql/my.cnf(30)
        /// mysql/test.db(25000)


    }

}
